  package jerry.html.data;

import java.util.HashMap;
import java.util.Map;

/**
 * Class to hold game data.
 * 
 * @author (h0t@_G0|i
 */

public class Game implements DataType{
	
	private static final long serialVersionUID = -7058247847035255450L;
	private Double totalTime = 0.0;
	private Map<Integer, Player[]> playersInTeam;
	private String gameEndString;
	private Map<String, String> gameDetails;
	private String identity;
	private Map<Integer, Score> teamScore;
	/**
	 * @return the totalTime
	 */
	public Double getTotalTime() {
		return totalTime;
	}
	/**
	 * @param totalTime the totalTime to set
	 */
	public void setTotalTime(Double totalTime) {
		this.totalTime = totalTime;
	}
	/**
	 * @return the playersInTeam
	 */
	public Map<Integer, Player[]> getPlayersInTeam() {
		if(playersInTeam == null) {
			playersInTeam = new HashMap<Integer, Player[]>();
			playersInTeam.put(0, new Player[32]);
		}
		return playersInTeam;
	}
	
	/**
	 * @param playersInTeam the playersInTeam to set
	 */
	public void setPlayersInTeam(Map<Integer, Player[]> playersInTeam) {
		this.playersInTeam = playersInTeam;
	}

	/**
	 * @return the gameEndString
	 */
	public String getGameEndString() {
		return gameEndString;
	}
	/**
	 * @param gameEndString the gameEndString to set
	 */
	public void setGameEndString(String gameEndString) {
		this.gameEndString = gameEndString;
	}
	/**
	 * @return the gameDetails
	 */
	public Map<String, String> getGameDetails() {
		if(gameDetails == null) {
			gameDetails = new HashMap<String, String>();
		}
		return gameDetails;
	}
	
	/**
	 * @param gameDetails the gameDetails to set
	 */
	public void setGameDetails(Map<String, String> gameDetails) {
		this.gameDetails = gameDetails;
	}
	/* (non-Javadoc)
	 * @see jerry.html.data.DataType#getIdentity()
	 */
	public String getIdentity() {
		return identity;
	}
	
	/**
	 * @param identity the identity to set
	 */
	public void setIdentity(String identity) {
		this.identity = identity;
	}
	
	/**
	 * @return the teamScore
	 */
	public Map<Integer, Score> getTeamScore() {
		if(teamScore == null) {
			teamScore = new HashMap<Integer, Score>();
		}
		return teamScore;
	}
	
	/**
	 * @param teamScore the teamScore to set
	 */
	public void setTeamScore(Map<Integer, Score> teamScore) {
		this.teamScore = teamScore;
	}
}
